/*
 * @(#)JvmPointNoticeImpl.java   1.0  2022年3月10日
 * 
 * Copyright (c)	2014-2020. All Rights Reserved.	GuangZhou hhmk Technology Company LTD.
 */
package com.swift.monitor.core.notice.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.swift.monitor.core.alarm.AlarmNotice;
import com.swift.monitor.core.notice.AbstractMonitorNotice;
import com.swift.monitor.core.notice.JvmMonitorNotice;
import com.swift.monitor.core.point.AlarmLevel;
import com.swift.monitor.core.point.JvmPoint;

/**
 * 添加说明 
 * @author zhengjiajin
 * @version 1.0 2022年3月10日
 */
@Component
public class JvmPointNoticeImpl extends AbstractMonitorNotice<JvmPoint> implements JvmMonitorNotice {

    protected static final Logger log = LoggerFactory.getLogger(JvmPointNoticeImpl.class);
    
    @Autowired
    private List<AlarmNotice<JvmPoint>> alarmNoticeList;

    /** 
     * @see com.swift.monitor.core.notice.AbstractMonitorNotice#doNotice(com.swift.monitor.core.point.Point)
     */
    @Override
    protected void doNotice(JvmPoint t) {
        if(t==null) return;
        //记算告警级别和告警信息
        if(t.getLevel()==null) t.setLevel(AlarmLevel.INFO);
        if(t.getAlarmInfo()==null) t.setAlarmInfo("");
        setAlarmLevel(t, "sysCpuLate",70,95);
        setAlarmLevel(t, "jvmCpuLate",70,95);
        setAlarmLevel(t, "memoryLate",70,90);
        //如出现告警则通知
        for(AlarmNotice<JvmPoint> alarmNotice:alarmNoticeList) {
            alarmNotice.alarm(t);
        }
    }
    
    
    
}
